//
//  AboutViewController.m
//  Againstpoor
//
//  Created by 辰领科技 on 16/11/6.
//  Copyright © 2016年 yuf. All rights reserved.
//

#import "AboutViewController.h"

@interface AboutViewController ()
@property (strong, nonatomic) IBOutlet UIView *navView;
@property (strong, nonatomic) IBOutlet UIWebView *webView;
@property (strong, nonatomic) IBOutlet UIScrollView *scroview;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@end

@implementation AboutViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    if (_type == 1) {
        _titleLabel.text = @"关于我们";
    } else if (_type == 2 || _type == 3) {
        _titleLabel.text = @"详情";
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initViewLayout];
    [self loadData];
    
}


- (void)initViewLayout {
    [self adaptiveViewLayout:self.view];
    [self adaptiveViewLayout:self.navView];
    [self adaptiveViewLayout:self.scroview];
    self.scroview.contentSize = flexibleSize(CGSizeMake(320, 504.5), YES);
    
}

-(void)loadData{
    NSURLRequest *req;
    if (_type == 1) {
        req  = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@%@",IP_Address_Fresh,F_aboutUs]]];
    } else if (_type == 2) {
        req  = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@%@%@",IP_Address_Fresh,F_advertismentDetail,_ID]]];
    } else if (_type == 3) {
        req  = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@%@%@",IP_Address_Fresh,F_articlesDetail,_artiId]]];
    }
    
    [_webView loadRequest:req];
}



#pragma mark - 返回
- (IBAction)back:(id)sender {
    [self backBtn];
}

@end
